// 2的幂

package Leetcode;

class Solution_231 {
    public boolean isPowerOfTwo(int n) {
        if(n <= 0)
            return false;
        int count = 0;
        int bits = 1;
        while (n != 0) {
            if ((n & bits) == 1)
                count++;
            n >>= 1;
        }
        return count == 1 ? true : false;
    }
}